﻿@model IEnumerable<Amba.DownloadsCounter.ViewModels.Admin.ByFileViewModel>
@{
    Layout.Title = T("Download Statistics by File");
}
<script type="text/javascript">
        function resetCounter(id, url) {
            $.get('@Url.Action("ResetCounter", "Admin", new {area="Amba.DownloadsCounter"})?url=' + url, function () {
                $('#' + id + ' .counter_count').html('0');
                $('#' + id + ' .counter_last_download').html('');
            } );
            return false;
        }
    </script>
<table class="items html-blocks-table">
    <thead>
        <tr>
            <th>
                @T("URL")
            </th>
            <th>
                @T("Count")
            </th>
            <th>
                @T("Last Download")
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @{ var id = 0; }
        @foreach(var item in Model.OrderByDescending(x => x.Count))
        {
            id++;
            <tr id="counter_@(id)">
                <td class="counter_url">@item.Url</td>
                <td class="counter_count">@item.Count</td>
                <td class="counter_last_download">@item.LastDownload</td>
                <td class="counter_reset_button"><a href="#!" onclick="resetCounter('counter_@(id)', '@Html.Raw(Url.Encode(item.Url))')">@T("Reset")</a></td>
            </tr>
        }
    </tbody>
    
</table>